package cn.maydaymemory.maydaycore.message.util;


public class EdgingUtil {
    public static String getHeader(String title,int length){
        title="§f["+title+"§f]";
        return getAppended(title, length);
    }
    static String getFooter(String center,int length){
        center="§f "+center+" ";
        return getAppended(center, length);
    }

    private static String getAppended(String center, int length) {
        int lineLength = length- StringUtil.getGBKLengthWithoutColorCode(center);
        StringBuilder builder = new StringBuilder();
        builder.append("§e");
        for(int f = 0;f<lineLength/2;f++) builder.append("=");
        builder.append(center);
        builder.append("§e");
        for(int f=0;f<lineLength-(lineLength/2);f++) builder.append("=");
        return builder.toString();
    }
}
